<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>继承中的super关键字</title>
		<script type="text/javascript">
			class Father {
				constructor(x,y) {
					this.x = x;
					this.y  = y;
				}
				sum() {
					console.log(this.x + this.y);//this指向当前类
				}
			}
			class Son extends Father {
				constructor(x,y) {
					//将传到Son中的值传递到父类中的构造函数中
					super(x,y);
				}
			}
			//调用父类中的sum方法
			var son = new Son(1,2);
			var son1 = new Son(2,3);
			son.sum();
			son1.sum();
		</script>
	</head>
	<body>
	</body>
</html>
